package fr.afcepf.ticketing.service;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import fr.afcepf.ticketing.dao.CatalogDao;
import fr.afcepf.ticketing.domain.Catalog;

@Stateless
public class CatalogServicesBean implements CatalogServices {
	
	@EJB
	private CatalogDao ejbCatalogDao;

	
	public List<Catalog> getAllCatalogs(){
		return (List<Catalog>) ejbCatalogDao.allCatalogs();		
	}

	
	@Override
	public void updateCatalog(Catalog catalog) {
		ejbCatalogDao.updateEntity(catalog);
	}

	@Override
	public void deleteCatalog(long id) {
		ejbCatalogDao.deleteEntityFromPk(id);
	}

	@Override
	public long insertNewCatalog(Catalog catalog) {
		ejbCatalogDao.createEntity(catalog);
		return catalog.getId();
	}

}
